// JavaScript Document

$(function(){
		$(".yhj_head_info ul li:has('p')").bind({
			mouseover:function(e){
				 if(yhj_checkHover(e,this)){
					$(this).css("background","#69f");
					$(this).children("span").css("border-top","6px solid #fff");
					//$(this).children().slideDown("fast");
					$(this).children().toggle(150);
				 }
			},
			mouseout:function(e){
				if(yhj_checkHover(e,this)){
					$(this).css("background","");
					$(this).children("span").css("border-top","6px solid #4b4b4b");
					//$(this).children().slideUp("fast");
					$(this).children().toggle(150);
				}
			}
		});	
		$(".yhj_head_info_login ul li:has('p')").bind({//<!--用户登录后的头界面,用session来判断-->
			mouseover:function(e){
				 if(yhj_checkHover(e,this)){
					$(this).css("background","#69f");
					$(this).children("span").css("border-top","6px solid #fff");
					//$(this).children().slideDown("fast");
					$(this).children().toggle(150);
				 }
			},
			mouseout:function(e){
				if(yhj_checkHover(e,this)){
					$(this).css("background","");
					$(this).children("span").css("border-top","6px solid #4b4b4b");
					//$(this).children().slideUp("fast");
					$(this).children().toggle(150);
				}
			}
		});
	})
	
	function yhj_contains(parentNode, childNode) {//判断元素包含与否的方法，菜单用
		if (parentNode.contains) {
			return parentNode != childNode && parentNode.contains(childNode);
		} else {
			return !!(parentNode.compareDocumentPosition(childNode) & 16);
		}
	}
	
	function yhj_checkHover(e,target){//菜单用
    if (yhj_getEvent(e).type=="mouseover")  {
        return !yhj_contains(target,yhj_getEvent(e).relatedTarget||yhj_getEvent(e).fromElement) && !((yhj_getEvent(e).relatedTarget||yhj_getEvent(e).fromElement)===target);
    } else {
        return !yhj_contains(target,yhj_getEvent(e).relatedTarget||yhj_getEvent(e).toElement) && !((yhj_getEvent(e).relatedTarget||yhj_getEvent(e).toElement)===target);
    }
	}function yhj_getEvent(e){
		return e||window.event;
	}


	